/*
 * @Author: your name
 * @Date: 2021-01-26 11:07:26
 * @LastEditTime: 2021-01-29 15:59:27
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \tlwok-front-purchase-platfrom\src\api\purchase\offlineOrder.js
 */
import Http from '@/lib/http';

export const exportUrl = Http.getUrl('/purchase/offlineOrder/export');

export function pageList (data) {
  return Http.get('/purchase/offlineOrder/pageList', {
    ...data,
  });
}

export function confirmDelivery (purchaseNo) {
  return Http.post('/purchase/offlineOrder/confirmDelivery', {
    purchaseNo,
  });
}

export function confirmFinish (purchaseNo) {
  return Http.post('/purchase/offlineOrder/confirmFinish', {
    purchaseNo,
  });
}

export function offlinePay (purchaseNo) {
  return Http.post('/purchase/offlineOrder/offlinePay', {
    purchaseNo,
  });
}

export function invalid (purchaseNo) {
  return Http.post('/purchase/offlineOrder/invalid', {
    purchaseNo,
  });
}

export function add (data) {
  return Http.post('/purchase/offlineOrder/add', { ...data });
}

export function update (data) {
  return Http.post('/purchase/offlineOrder/update', { ...data });
}

export function detail (purchaseNo) {
  return Http.get('/purchase/offlineOrder/detail', { purchaseNo });
}

export function applyPay (data) {
  return Http.post('/purchase/offlineOrder/applyPay', { ...data });
}

export function uploadPayVoucher (file, purchaseNo) {
  const fd = new FormData();
  fd.append('file', file);
  fd.append('purchaseNo', purchaseNo);
  return Http.post('/purchase/offlineOrder/uploadPayVoucher', fd);
}

export function getPayVoucher (data) {
  return Http.get('/purchase/offlineOrder/getPayVoucher', { ...data });
}

export function uploadInvoice (file, purchaseNo) {
  const fd = new FormData();
  fd.append('file', file);
  fd.append('purchaseNo', purchaseNo);
  return Http.post('/purchase/offlineOrder/uploadInvoice', fd);
}

export function getDownloadInvoiceUrl (purchaseNo) {
  return Http.getUrl(`/purchase/offlineOrder/downloadInvoice?purchaseNo=${purchaseNo}`);
}

export function uploadContract (file) {
  const fd = new FormData();
  fd.append('file', file);
  return Http.post('/purchase/offlineOrder/uploadContract', fd);
}

export function getDownloadContractUrl (itemId) {
  return Http.getUrl(`/purchase/offlineOrder/downloadContract?itemId=${itemId}`);
}

export function relateOrderEdit (data) {
  return Http.post('/purchase/offlineOrder/relateOrder/edit', {
    ...data,
  });
}
